/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sadfinanceiro;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 *
 * @author Felipe
 */
@Entity
@Table(name = "CENARIOS")
@NamedQueries({@NamedQuery(name = "Cenarios.findAll", query = "SELECT c FROM Cenarios c"), @NamedQuery(name = "Cenarios.findByIdcenario", query = "SELECT c FROM Cenarios c WHERE c.idcenario = :idcenario"), @NamedQuery(name = "Cenarios.findByCapitalinicial", query = "SELECT c FROM Cenarios c WHERE c.capitalinicial = :capitalinicial"), @NamedQuery(name = "Cenarios.findByRentabilidade", query = "SELECT c FROM Cenarios c WHERE c.rentabilidade = :rentabilidade"), @NamedQuery(name = "Cenarios.findByPrazo", query = "SELECT c FROM Cenarios c WHERE c.prazo = :prazo"), @NamedQuery(name = "Cenarios.findByReforcomensal", query = "SELECT c FROM Cenarios c WHERE c.reforcomensal = :reforcomensal"), @NamedQuery(name = "Cenarios.findByValorfuturo", query = "SELECT c FROM Cenarios c WHERE c.valorfuturo = :valorfuturo"), @NamedQuery(name = "Cenarios.findByDatasimulacao", query = "SELECT c FROM Cenarios c WHERE c.datasimulacao = :datasimulacao")})
public class Cenarios implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY ) 
    @Column(name = "IDCENARIO")
    private Short idcenario;
    @Basic(optional = false)
    @Column(name = "CAPITALINICIAL")
    private double capitalinicial;
    @Basic(optional = false)
    @Column(name = "RENTABILIDADE")
    private double rentabilidade;
    @Basic(optional = false)
    @Column(name = "PRAZO")
    private short prazo;
    @Basic(optional = false)
    @Column(name = "REFORCOMENSAL")
    private double reforcomensal;
    @Basic(optional = false)
    @Column(name = "VALORFUTURO")
    private double valorfuturo;
    @Basic(optional = false)
    @Column(name = "DATASIMULACAO")
    @Temporal(TemporalType.DATE)
    private Date datasimulacao;

    public Cenarios() {
    }

    public Cenarios(Short idcenario) {
        this.idcenario = idcenario;
    }

    public Cenarios(Short idcenario, double capitalinicial, double rentabilidade, short prazo, double reforcomensal, double valorfuturo, Date datasimulacao) {
        this.idcenario = idcenario;
        this.capitalinicial = capitalinicial;
        this.rentabilidade = rentabilidade;
        this.prazo = prazo;
        this.reforcomensal = reforcomensal;
        this.valorfuturo = valorfuturo;
        this.datasimulacao = datasimulacao;
    }

    public Short getIdcenario() {
        return idcenario;
    }

    public void setIdcenario(Short idcenario) {
        Short oldIdcenario = this.idcenario;
        this.idcenario = idcenario;
        changeSupport.firePropertyChange("idcenario", oldIdcenario, idcenario);
    }

    public double getCapitalinicial() {
        return capitalinicial;
    }

    public void setCapitalinicial(double capitalinicial) {
        double oldCapitalinicial = this.capitalinicial;
        this.capitalinicial = capitalinicial;
        changeSupport.firePropertyChange("capitalinicial", oldCapitalinicial, capitalinicial);
    }

    public double getRentabilidade() {
        return rentabilidade;
    }

    public void setRentabilidade(double rentabilidade) {
        double oldRentabilidade = this.rentabilidade;
        this.rentabilidade = rentabilidade;
        changeSupport.firePropertyChange("rentabilidade", oldRentabilidade, rentabilidade);
    }

    public short getPrazo() {
        return prazo;
    }

    public void setPrazo(short prazo) {
        short oldPrazo = this.prazo;
        this.prazo = prazo;
        changeSupport.firePropertyChange("prazo", oldPrazo, prazo);
    }

    public double getReforcomensal() {
        return reforcomensal;
    }

    public void setReforcomensal(double reforcomensal) {
        double oldReforcomensal = this.reforcomensal;
        this.reforcomensal = reforcomensal;
        changeSupport.firePropertyChange("reforcomensal", oldReforcomensal, reforcomensal);
    }

    public double getValorfuturo() {
        return valorfuturo;
    }

    public void setValorfuturo(double valorfuturo) {
        double oldValorfuturo = this.valorfuturo;
        this.valorfuturo = valorfuturo;
        changeSupport.firePropertyChange("valorfuturo", oldValorfuturo, valorfuturo);
    }

    public Date getDatasimulacao() {
        return datasimulacao;
    }

    public void setDatasimulacao(Date datasimulacao) {
        Date oldDatasimulacao = this.datasimulacao;
        this.datasimulacao = datasimulacao;
        changeSupport.firePropertyChange("datasimulacao", oldDatasimulacao, datasimulacao);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcenario != null ? idcenario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cenarios)) {
            return false;
        }
        Cenarios other = (Cenarios) object;
        if ((this.idcenario == null && other.idcenario != null) || (this.idcenario != null && !this.idcenario.equals(other.idcenario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sadfinanceiro.Cenarios[idcenario=" + idcenario + "]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
